home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / ImageListBox.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-12-16  |  21.4 KB  |  1,609 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Event;
  8. import java.awt.Font;
  9. import java.awt.FontMetrics;
  10. import java.awt.Graphics;
  11. import java.awt.Image;
  12. import java.awt.LayoutManager;
  13. import java.awt.Panel;
  14. import java.awt.Rectangle;
  15. import java.awt.Scrollbar;
  16. import java.awt.image.MemoryImageSource;
  17. import java.util.Vector;
  18.  
  19. public class ImageListBox extends Panel {
  20.    public static final int EVT_IMAGE_SELECT = 16388;
  21.    public static final int BORDER_REGULAR = 0;
  22.    public static final int BORDER_NONE = 1;
  23.    public static final int IMAGE_WIDTH = 19;
  24.    private final int LINE_SLOP;
  25.    protected int nTopRow;
  26.    protected int lWidth;
  27.    protected int cellHt;
  28.    protected int yAdj;
  29.    protected int borderWidth;
  30.    protected int halfBorderWidth;
  31.    private Component ilbParent;
  32.    private String ilbLabel;
  33.    private Image SelectImage;
  34.    private Scrollbar VBar;
  35.    private Scrollbar HBar;
  36.    private Vector items;
  37.    private Font font;
  38.    // $FF: renamed from: fm java.awt.FontMetrics
  39.    private FontMetrics field_0;
  40.    private boolean bAllDirty;
  41.    private boolean bMultipleSelections;
  42.    private boolean bBlockPaint;
  43.    private boolean bVBarVisible;
  44.    private boolean bHBarVisible;
  45.    private boolean bInternalBlockPaint;
  46.    private int rowsToShow;
  47.    private int colsToShow;
  48.    private int visibleRows;
  49.    private int visibleCols;
  50.    private int visibleIndex;
  51.    private int fontHeight;
  52.    private int fontDescent;
  53.    private int lastDownModifiers;
  54.    private int lastSelected;
  55.    private int lastIndex;
  56.    private int lastTempIndex;
  57.    private int countSelected;
  58.    private int borderType;
  59.    private int longestLineValue;
  60.    private int barSize;
  61.    private int xCoord;
  62.    private long prevSelectTime;
  63.    private long prevSelectRow;
  64.    private boolean bOsFlag;
  65.    private boolean bComboMode;
  66.    private boolean bCellBorders;
  67.    private boolean bAllowShowVBar;
  68.    private boolean bAllowShowHBar;
  69.    private Color enabledColor;
  70.    private Color disabledColor;
  71.    private int fastDownCount;
  72.    private boolean bMouseDrawHandled;
  73.    private boolean bClipRectHack;
  74.    private boolean bDirectNotify;
  75.  
  76.    public ImageListBox() {
  77.       this((Component)null, "", -1, false);
  78.    }
  79.  
  80.    public ImageListBox(String var1) {
  81.       this((Component)null, var1, -1, false);
  82.    }
  83.  
  84.    public ImageListBox(String var1, boolean var2) {
  85.       this((Component)null, var1, -1, var2);
  86.    }
  87.  
  88.    public ImageListBox(String var1, int var2, boolean var3) {
  89.       this((Component)null, var1, var2, var3);
  90.    }
  91.  
  92.    public ImageListBox(Component var1, String var2) {
  93.       this(var1, var2, -1, false);
  94.    }
  95.  
  96.    public ImageListBox(Component var1, String var2, int var3, boolean var4) {
  97.       this.LINE_SLOP = 6;
  98.       this.yAdj = 6;
  99.       this.borderWidth = 4;
  100.       this.halfBorderWidth = 2;
  101.       this.bAllDirty = true;
  102.       this.bMultipleSelections = false;
  103.       this.bBlockPaint = false;
  104.       this.bVBarVisible = false;
  105.       this.bHBarVisible = false;
  106.       this.bInternalBlockPaint = false;
  107.       this.rowsToShow = -1;
  108.       this.colsToShow = 10;
  109.       this.visibleRows = -1;
  110.       this.visibleCols = -1;
  111.       this.visibleIndex = -1;
  112.       this.lastDownModifiers = -1;
  113.       this.lastSelected = -1;
  114.       this.lastIndex = -1;
  115.       this.lastTempIndex = -1;
  116.       this.barSize = 15;
  117.       this.prevSelectTime = -1L;
  118.       this.prevSelectRow = -1L;
  119.       this.bComboMode = false;
  120.       this.bCellBorders = false;
  121.       this.bAllowShowVBar = true;
  122.       this.bAllowShowHBar = true;
  123.       this.enabledColor = Color.black;
  124.       this.disabledColor = Color.gray;
  125.       this.bMouseDrawHandled = false;
  126.       this.bClipRectHack = false;
  127.       this.bDirectNotify = true;
  128.       if (!System.getProperty("os.name").startsWith("S")) {
  129.          this.bOsFlag = false;
  130.          this.barSize = 15;
  131.       } else {
  132.          this.bOsFlag = true;
  133.          this.barSize = 17;
  134.       }
  135.  
  136.       this.items = new Vector();
  137.       this.ilbParent = var1;
  138.       this.ilbLabel = var2;
  139.       this.rowsToShow = var3;
  140.       this.bMultipleSelections = var4;
  141.       byte var5 = 20;
  142.       byte var6 = 20;
  143.       int[] var7 = new int[var5 * var6];
  144.       int var8 = 0;
  145.  
  146.       for(int var9 = 0; var9 < var6; ++var9) {
  147.          for(int var10 = 0; var10 < var5; ++var10) {
  148.             var7[var8++] = -16777088;
  149.          }
  150.       }
  151.  
  152.       this.SelectImage = ((Component)this).createImage(new MemoryImageSource(var5, var6, var7, 0, var5));
  153.       ((Container)this).setLayout((LayoutManager)null);
  154.       ((Component)this).setBackground(Color.white);
  155.       this.VBar = new Scrollbar();
  156.       this.VBar.setBackground(Color.lightGray);
  157.       ((Container)this).add(this.VBar);
  158.       this.HBar = new Scrollbar(0);
  159.       this.HBar.setBackground(Color.lightGray);
  160.       ((Container)this).add(this.HBar);
  161.       this.setFont(new Font("Helvetica", 0, 12));
  162.    }
  163.  
  164.    public void setComboMode(boolean var1) {
  165.       this.bComboMode = var1;
  166.       this.yAdj = 6;
  167.       ((Component)this).invalidate();
  168.    }
  169.  
  170.    public boolean getComboMode() {
  171.       return this.bComboMode;
  172.    }
  173.  
  174.    public void setRowsToShow(int var1) {
  175.       this.rowsToShow = var1;
  176.       ((Component)this).invalidate();
  177.    }
  178.  
  179.    public int getRowsToShow() {
  180.       return this.rowsToShow;
  181.    }
  182.  
  183.    public void setShowVerticalScroll(boolean var1) {
  184.       if (this.bAllowShowVBar != var1) {
  185.          this.bAllowShowVBar = var1;
  186.          ((Component)this).invalidate();
  187.       }
  188.  
  189.    }
  190.  
  191.    public boolean getShowVerticalScroll() {
  192.       return this.bAllowShowVBar;
  193.    }
  194.  
  195.    public void setShowHorizontalScroll(boolean var1) {
  196.       if (this.bAllowShowHBar != var1) {
  197.          this.bAllowShowHBar = var1;
  198.          ((Component)this).invalidate();
  199.       }
  200.  
  201.    }
  202.  
  203.    public boolean getShowHorizontalScroll() {
  204.       return this.bAllowShowHBar;
  205.    }
  206.  
  207.    public void setBorderType(int var1) {
  208.       this.borderType = var1;
  209.       if (var1 == 0) {
  210.          this.borderWidth = 4;
  211.          this.halfBorderWidth = 2;
  212.       } else {
  213.          this.borderWidth = 0;
  214.          this.halfBorderWidth = 0;
  215.       }
  216.  
  217.       ((Component)this).invalidate();
  218.    }
  219.  
  220.    public int getBorderType() {
  221.       return this.borderType;
  222.    }
  223.  
  224.    public void setCellBorder(int var1, boolean var2) {
  225.       if (this.validIndex(var1)) {
  226.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  227.          if (var3.bCellBorder != var2) {
  228.             var3.bCellBorder = var2;
  229.             var3.bDirty = true;
  230.             ((Component)this).invalidate();
  231.          }
  232.       }
  233.  
  234.    }
  235.  
  236.    public void setCellBorders(boolean var1) {
  237.       this.bCellBorders = var1;
  238.       int var2 = this.items.size();
  239.       Object var3 = null;
  240.  
  241.       for(int var4 = 0; var4 < var2; ++var4) {
  242.          ListItem var5 = (ListItem)this.items.elementAt(var4);
  243.          var5.bCellBorder = var1;
  244.       }
  245.  
  246.       this.bAllDirty = true;
  247.       ((Component)this).invalidate();
  248.    }
  249.  
  250.    public boolean getCellBorders() {
  251.       return this.bCellBorders;
  252.    }
  253.  
  254.    public void setDefaultEnabledTextColor(Color var1) {
  255.       this.enabledColor = var1;
  256.       ((Component)this).invalidate();
  257.    }
  258.  
  259.    public Color getDefaultEnabledTextColor() {
  260.       return this.enabledColor;
  261.    }
  262.  
  263.    public void setDisabledTextColor(Color var1) {
  264.       this.disabledColor = var1;
  265.       ((Component)this).invalidate();
  266.    }
  267.  
  268.    public Color getDisabledTextColor() {
  269.       return this.disabledColor;
  270.    }
  271.  
  272.    public void setEnabledTextColor(int var1, Color var2) {
  273.       if (this.validIndex(var1)) {
  274.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  275.          var3.color = var2;
  276.       }
  277.  
  278.    }
  279.  
  280.    public boolean handleEvent(Event var1) {
  281.       int var5 = -1;
  282.       switch (var1.id) {
  283.          case 403:
  284.             if (var1.modifiers <= 1) {
  285.                switch (var1.key) {
  286.                   case 1000:
  287.                      var5 = this.keyCalcIndex(0, true);
  288.                      break;
  289.                   case 1001:
  290.                      var5 = this.keyCalcIndex(this.items.size() - 1, true);
  291.                      break;
  292.                   case 1002:
  293.                      var5 = this.keyCalcIndex(-this.visibleRows, false);
  294.                      break;
  295.                   case 1003:
  296.                      var5 = this.keyCalcIndex(this.visibleRows, false);
  297.                      break;
  298.                   case 1004:
  299.                      var5 = this.keyCalcIndex(-1, false);
  300.                      break;
  301.                   case 1005:
  302.                      var5 = this.keyCalcIndex(1, false);
  303.                }
  304.  
  305.                if (var5 != -1) {
  306.                   if (this.bMultipleSelections) {
  307.                      switch (var1.modifiers) {
  308.                         case 0:
  309.                            break;
  310.                         case 1:
  311.                            this.makeVisible(var5);
  312.                            this.shiftSelect(var5, false);
  313.                            return true;
  314.                         default:
  315.                            return true;
  316.                      }
  317.                   }
  318.  
  319.                   this.select(var5);
  320.                   ((Component)this).repaint();
  321.                   var1.x = -1;
  322.                   this.notifyParent(var1, var5, false);
  323.                   this.prevSelectTime = -1L;
  324.                   this.prevSelectRow = -1L;
  325.                   return true;
  326.                }
  327.             }
  328.             break;
  329.          case 501:
  330.             ++this.fastDownCount;
  331.             this.bMouseDrawHandled = false;
  332.             this.lastDownModifiers = var1.modifiers;
  333.             if (var1.x > -1 && var1.x < this.lWidth) {
  334.                var5 = this.mouseCalcIndex(var1.y);
  335.                if (var5 == -1) {
  336.                   return true;
  337.                }
  338.  
  339.                if (this.bMultipleSelections) {
  340.                   switch (this.lastDownModifiers) {
  341.                      case 1:
  342.                         this.bMouseDrawHandled = true;
  343.                         this.shiftSelect(var5, false);
  344.                         break;
  345.                      case 2:
  346.                         this.bMouseDrawHandled = true;
  347.                         this.ctrlSelect(var5);
  348.                         break;
  349.                      case 3:
  350.                         this.bMouseDrawHandled = true;
  351.                         this.shiftSelect(var5, true);
  352.                         break;
  353.                      default:
  354.                         this.select(var5);
  355.                   }
  356.  
  357.                   ((Component)this).repaint();
  358.                } else {
  359.                   this.lastTempIndex = var5;
  360.                   if (this.lastSelected == var5) {
  361.                      return true;
  362.                   }
  363.  
  364.                   this.select(var5);
  365.                   ((Component)this).repaint();
  366.                }
  367.             }
  368.  
  369.             return true;
  370.          case 502:
  371.             --this.fastDownCount;
  372.             if (this.bMouseDrawHandled) {
  373.                var1.x = -1;
  374.                this.notifyParent(var1, -1, false);
  375.                return true;
  376.             }
  377.  
  378.             if (!this.bMultipleSelections) {
  379.                var5 = this.mouseCalcIndex(var1.y);
  380.                if (var5 == -1 || var1.x < 0 || var1.x >= this.lWidth) {
  381.                   this.fastDownCount = 0;
  382.                   var5 = this.lastTempIndex;
  383.                   if (var5 == -1) {
  384.                      return true;
  385.                   }
  386.                }
  387.             }
  388.  
  389.             boolean var4;
  390.             if (this.bComboMode) {
  391.                this.fastDownCount = 0;
  392.                var4 = false;
  393.             } else if (this.fastDownCount > 0) {
  394.                this.fastDownCount = 0;
  395.                var4 = true;
  396.                this.prevSelectTime = -1L;
  397.                this.prevSelectRow = -1L;
  398.             } else {
  399.                long var2 = System.currentTimeMillis();
  400.                if (this.prevSelectTime != -1L && this.prevSelectRow == (long)var5 && this.prevSelectTime + 250L > var2) {
  401.                   var4 = true;
  402.                   this.prevSelectTime = -1L;
  403.                   this.prevSelectRow = -1L;
  404.                } else {
  405.                   var4 = false;
  406.                   this.prevSelectTime = var2;
  407.                   this.prevSelectRow = (long)var5;
  408.                }
  409.             }
  410.  
  411.             if (this.lastSelected != var5) {
  412.                this.select(var5);
  413.                ((Component)this).repaint();
  414.             }
  415.  
  416.             if (this.bMultipleSelections) {
  417.                this.notifyParent(var1, this.lastSelected, var4);
  418.                this.lastIndex = this.lastSelected;
  419.             } else {
  420.                this.notifyParent(var1, var5, var4);
  421.                this.lastIndex = var5;
  422.             }
  423.  
  424.             this.lastTempIndex = -1;
  425.             this.lastDownModifiers = -1;
  426.             return true;
  427.          case 503:
  428.             if (this.bMultipleSelections) {
  429.                break;
  430.             }
  431.          case 506:
  432.             if (var1.x > -1 && var1.x < this.lWidth) {
  433.                if (this.bComboMode) {
  434.                   var5 = this.mouseCalcIndex(var1.y);
  435.                   if (var5 == -1 || var5 == this.lastIndex) {
  436.                      return true;
  437.                   }
  438.  
  439.                   this.lastIndex = var5;
  440.                   this.select(var5);
  441.                   ((Component)this).repaint();
  442.                } else if (var1.id == 506) {
  443.                   var5 = this.mouseCalcIndex(var1.y);
  444.                   if (var5 != -1 && var5 != this.lastIndex) {
  445.                      if (this.bMultipleSelections) {
  446.                         if (this.lastDownModifiers != 0) {
  447.                            return false;
  448.                         }
  449.  
  450.                         this.bInternalBlockPaint = true;
  451.                         this.makeVisible(var5);
  452.                         this.bInternalBlockPaint = false;
  453.                         this.shiftSelect(var5, false);
  454.                      } else {
  455.                         this.select(var5);
  456.                      }
  457.  
  458.                      this.lastIndex = var5;
  459.                   }
  460.                }
  461.             }
  462.             break;
  463.          case 505:
  464.             if (!this.bMultipleSelections && this.bComboMode) {
  465.                this.lastIndex = -1;
  466.             }
  467.             break;
  468.          case 601:
  469.             if (var1.target == this.VBar) {
  470.                this.scrollVertical(var1.id, false);
  471.             } else {
  472.                this.scrollHorizontal(var1.id, false);
  473.             }
  474.             break;
  475.          case 602:
  476.             if (var1.target == this.VBar) {
  477.                this.scrollVertical(var1.id, false);
  478.             } else {
  479.                this.scrollHorizontal(var1.id, false);
  480.             }
  481.             break;
  482.          case 603:
  483.             if (var1.target == this.VBar) {
  484.                this.scrollVertical(var1.id, false);
  485.             } else {
  486.                this.scrollHorizontal(var1.id, false);
  487.             }
  488.             break;
  489.          case 604:
  490.             if (var1.target == this.VBar) {
  491.                this.scrollVertical(var1.id, false);
  492.             } else {
  493.                this.scrollHorizontal(var1.id, false);
  494.             }
  495.             break;
  496.          case 605:
  497.             if (var1.target == this.VBar) {
  498.                this.scrollVertical((Integer)var1.arg, true);
  499.             } else {
  500.                this.scrollHorizontal((Integer)var1.arg, true);
  501.             }
  502.       }
  503.  
  504.       return false;
  505.    }
  506.  
  507.    public synchronized void setMultiColumnMode(boolean var1) {
  508.       this.bComboMode = false;
  509.       this.yAdj = 2;
  510.       this.setBorderType(1);
  511.       this.setCellBorders(var1);
  512.    }
  513.  
  514.    public synchronized void addItem(String var1) {
  515.       this.addItem(new ListItem((Image)null, var1, true, this.field_0, this.bCellBorders));
  516.    }
  517.  
  518.    public void setListItems(String[] var1) {
  519.       this.clear();
  520.  
  521.       for(int var2 = 0; var2 < var1.length; ++var2) {
  522.          this.addItem(var1[var2]);
  523.       }
  524.  
  525.    }
  526.  
  527.    public String[] getListItems() {
  528.       int var1 = this.countItems();
  529.       String[] var2 = new String[var1];
  530.  
  531.       for(int var3 = 0; var3 < var1; ++var3) {
  532.          var2[var3] = this.getItem(var3);
  533.       }
  534.  
  535.       return var2;
  536.    }
  537.  
  538.    public synchronized void addItem(String var1, boolean var2) {
  539.       this.addItem(new ListItem((Image)null, var1, var2, this.field_0, this.bCellBorders));
  540.    }
  541.  
  542.    public synchronized void addItem(Image var1, String var2) {
  543.       this.addItem(new ListItem(var1, var2, true, this.field_0, this.bCellBorders));
  544.    }
  545.  
  546.    public synchronized void addItem(Image var1, String var2, boolean var3) {
  547.       this.addItem(new ListItem(var1, var2, var3, this.field_0, this.bCellBorders));
  548.    }
  549.  
  550.    public synchronized void addItem(Image var1, String var2, boolean var3, Color var4) {
  551.       ListItem var5 = new ListItem(var1, var2, var3, this.field_0, this.bCellBorders);
  552.       var5.color = var4;
  553.       this.addItem(var5);
  554.    }
  555.  
  556.    private void addItem(ListItem var1) {
  557.       this.items.addElement(var1);
  558.       this.updateWidth(var1);
  559.       if (!this.bInternalBlockPaint) {
  560.          ((Component)this).repaint();
  561.       }
  562.  
  563.    }
  564.  
  565.    public synchronized void insertItem(int var1, Image var2, String var3, boolean var4) {
  566.       Object var5 = null;
  567.       ListItem var6;
  568.       if (this.validIndex(var1)) {
  569.          this.items.insertElementAt(var6 = new ListItem(var2, var3, var4, this.field_0, this.bCellBorders), var1);
  570.          this.bAllDirty = true;
  571.          if (this.lastSelected >= var1) {
  572.             ++this.lastSelected;
  573.          }
  574.       } else {
  575.          this.items.addElement(var6 = new ListItem(var2, var3, var4, this.field_0, this.bCellBorders));
  576.       }
  577.  
  578.       this.updateWidth(var6);
  579.       if (!this.bInternalBlockPaint) {
  580.          ((Component)this).repaint();
  581.       }
  582.  
  583.    }
  584.  
  585.    public synchronized void insertItems(int var1, Vector var2, Image var3, boolean var4) {
  586.       int var5 = var2.size();
  587.       boolean var6 = false;
  588.       if (this.validIndex(var1)) {
  589.          for(int var7 = 0; var7 < var5; ++var7) {
  590.             this.items.insertElementAt(new ListItem(var3, (String)var2.elementAt(var7), var4, this.field_0, this.bCellBorders), var1++);
  591.          }
  592.       } else {
  593.          for(int var8 = 0; var8 < var5; ++var8) {
  594.             this.items.addElement(new ListItem(var3, (String)var2.elementAt(var8), var4, this.field_0, this.bCellBorders));
  595.          }
  596.       }
  597.  
  598.       this.deselectAll();
  599.       this.bAllDirty = true;
  600.       this.updateWidths(this.field_0);
  601.       if (!this.bInternalBlockPaint) {
  602.          ((Component)this).repaint();
  603.       }
  604.  
  605.    }
  606.  
  607.    public int countItems() {
  608.       return this.items.size();
  609.    }
  610.  
  611.    public String getItem(int var1) {
  612.       return this.validIndex(var1) ? ((ListItem)this.items.elementAt(var1)).sText : null;
  613.    }
  614.  
  615.    public Image getImage(int var1) {
  616.       return this.validIndex(var1) ? ((ListItem)this.items.elementAt(var1)).image : null;
  617.    }
  618.  
  619.    public void changeImage(int var1, Image var2) {
  620.       if (this.validIndex(var1)) {
  621.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  622.          var3.image = var2;
  623.          var3.bDirty = true;
  624.          if (!this.bInternalBlockPaint) {
  625.             ((Component)this).repaint();
  626.          }
  627.       }
  628.  
  629.    }
  630.  
  631.    public void changeText(int var1, String var2) {
  632.       if (this.validIndex(var1)) {
  633.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  634.          var3.sText = var2;
  635.          var3.bDirty = true;
  636.          var3.updateWidth(this.field_0);
  637.          this.updateWidth(var3);
  638.          if (!this.bInternalBlockPaint) {
  639.             ((Component)this).repaint();
  640.          }
  641.       }
  642.  
  643.    }
  644.  
  645.    public void setEdited(int var1, boolean var2) {
  646.       if (this.validIndex(var1)) {
  647.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  648.          var3.bEdited = var2;
  649.       }
  650.  
  651.    }
  652.  
  653.    public boolean getEdited(int var1) {
  654.       if (this.validIndex(var1)) {
  655.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  656.          return var2.bEdited;
  657.       } else {
  658.          return false;
  659.       }
  660.    }
  661.  
  662.    public void enable(int var1) {
  663.       if (this.validIndex(var1)) {
  664.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  665.          if (!var2.bEnabled) {
  666.             var2.bEnabled = true;
  667.             var2.bDirty = true;
  668.             if (!this.bInternalBlockPaint) {
  669.                ((Component)this).repaint();
  670.             }
  671.          }
  672.       }
  673.  
  674.    }
  675.  
  676.    public void disable(int var1) {
  677.       if (this.validIndex(var1)) {
  678.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  679.          if (var2.bEnabled) {
  680.             var2.bEnabled = false;
  681.             var2.bDirty = true;
  682.             this.deselect(var1);
  683.             if (!this.bInternalBlockPaint) {
  684.                ((Component)this).repaint();
  685.             }
  686.          }
  687.       }
  688.  
  689.    }
  690.  
  691.    public void enable(int var1, boolean var2) {
  692.       if (var2) {
  693.          this.enable(var1);
  694.       } else {
  695.          this.disable(var1);
  696.       }
  697.    }
  698.  
  699.    public boolean isEnabled(int var1) {
  700.       if (this.validIndex(var1)) {
  701.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  702.          return var2.bEnabled;
  703.       } else {
  704.          return false;
  705.       }
  706.    }
  707.  
  708.    public synchronized void clear() {
  709.       this.items = new Vector();
  710.       this.nTopRow = 0;
  711.       this.visibleIndex = -1;
  712.       this.lastDownModifiers = -1;
  713.       this.lastSelected = -1;
  714.       this.lastIndex = -1;
  715.       this.lastTempIndex = -1;
  716.       this.countSelected = 0;
  717.       this.prevSelectTime = -1L;
  718.       this.prevSelectRow = -1L;
  719.       this.VBar.setValues(1, 1, 0, 2);
  720.       this.VBar.hide();
  721.       this.bVBarVisible = false;
  722.       this.HBar.setValues(1, 1, 0, 2);
  723.       this.HBar.hide();
  724.       this.bHBarVisible = false;
  725.       this.bAllDirty = true;
  726.       this.bInternalBlockPaint = false;
  727.       this.bBlockPaint = false;
  728.       this.longestLineValue = 0;
  729.       this.xCoord = 0;
  730.       ((Component)this).repaint();
  731.    }
  732.  
  733.    public synchronized void delItem(int var1) {
  734.       if (this.validIndex(var1)) {
  735.          this.deselect(var1);
  736.          this.items.removeElementAt(var1);
  737.          this.bAllDirty = true;
  738.          this.scrollVertical(this.nTopRow, true);
  739.          this.updateWidths((FontMetrics)null);
  740.          if (!this.bInternalBlockPaint) {
  741.             ((Component)this).repaint();
  742.          }
  743.       }
  744.  
  745.    }
  746.  
  747.    public synchronized void delItems(int var1, int var2) {
  748.       int var3 = this.items.size();
  749.       if (var3 > 0) {
  750.          if (var2 >= var3) {
  751.             var2 = var3 - 1;
  752.          }
  753.  
  754.          if (var1 < 0) {
  755.             var1 = 0;
  756.          }
  757.  
  758.          if (var1 <= var2) {
  759.             this.bInternalBlockPaint = true;
  760.  
  761.             for(int var4 = var2; var4 >= var1; --var4) {
  762.                this.deselect(var4);
  763.                this.items.removeElementAt(var4);
  764.             }
  765.  
  766.             this.bInternalBlockPaint = false;
  767.             this.bAllDirty = true;
  768.             this.scrollVertical(this.nTopRow, true);
  769.             this.updateWidths((FontMetrics)null);
  770.             ((Component)this).repaint();
  771.          }
  772.       }
  773.  
  774.    }
  775.  
  776.    public synchronized void delSelectedItems() {
  777.       int var1 = this.items.size();
  778.       this.bInternalBlockPaint = true;
  779.       int var2 = 0;
  780.  
  781.       while(var2 < var1) {
  782.          ListItem var3 = (ListItem)this.items.elementAt(var2);
  783.          if (var3.bSelected) {
  784.             this.deselect(var2);
  785.             this.items.removeElementAt(var2);
  786.             --var1;
  787.          } else {
  788.             ++var2;
  789.          }
  790.       }
  791.  
  792.       this.bAllDirty = true;
  793.       this.scrollVertical(this.nTopRow, true);
  794.       this.updateWidths((FontMetrics)null);
  795.       this.bInternalBlockPaint = false;
  796.       ((Component)this).repaint();
  797.    }
  798.  
  799.    public synchronized int getSelectedIndex() {
  800.       return this.lastSelected;
  801.    }
  802.  
  803.    public synchronized int[] getSelectedIndexes() {
  804.       int[] var1 = new int[this.countSelected];
  805.       if (this.countSelected == 1) {
  806.          var1[0] = this.lastSelected;
  807.       } else if (this.countSelected > 1) {
  808.          int var2 = 0;
  809.          int var3 = this.items.size();
  810.  
  811.          for(int var4 = 0; var4 < var3; ++var4) {
  812.             ListItem var5 = (ListItem)this.items.elementAt(var4);
  813.             if (var5.bSelected) {
  814.                var1[var2++] = var4;
  815.                if (var2 == this.countSelected) {
  816.                   break;
  817.                }
  818.             }
  819.          }
  820.       }
  821.  
  822.       return var1;
  823.    }
  824.  
  825.    public synchronized String getSelectedItem() {
  826.       return this.lastSelected < 0 ? null : this.getItem(this.lastSelected);
  827.    }
  828.  
  829.    public synchronized String[] getSelectedItems() {
  830.       String[] var1 = new String[this.countSelected];
  831.       if (!this.bMultipleSelections) {
  832.          if (this.lastSelected != -1) {
  833.             ListItem var2 = (ListItem)this.items.elementAt(this.lastSelected);
  834.             var1[0] = var2.sText;
  835.          }
  836.       } else if (this.countSelected > 0) {
  837.          int var3 = 0;
  838.          int var4 = this.items.size();
  839.  
  840.          for(int var5 = 0; var5 < var4; ++var5) {
  841.             ListItem var6 = (ListItem)this.items.elementAt(var5);
  842.             if (var6.bSelected) {
  843.                var1[var3] = var6.sText;
  844.                ++var3;
  845.                if (var3 == this.countSelected) {
  846.                   break;
  847.                }
  848.             }
  849.          }
  850.       }
  851.  
  852.       return var1;
  853.    }
  854.  
  855.    public synchronized String getLabel() {
  856.       return new String(this.ilbLabel);
  857.    }
  858.  
  859.    public synchronized void select(int var1) {
  860.       if (this.isEnabled(var1)) {
  861.          Object var2 = null;
  862.          if (this.bMultipleSelections) {
  863.             int var3 = this.items.size();
  864.  
  865.             for(int var4 = 0; var4 < var3; ++var4) {
  866.                ListItem var6 = (ListItem)this.items.elementAt(var4);
  867.                if (var4 == var1) {
  868.                   if (!var6.bSelected) {
  869.                      var6.bSelected = true;
  870.                      var6.bDirty = true;
  871.                   }
  872.                } else if (var6.bSelected) {
  873.                   var6.bSelected = false;
  874.                   var6.bDirty = true;
  875.                }
  876.             }
  877.          } else if (this.lastSelected != var1) {
  878.             if (this.lastSelected != -1) {
  879.                this.deselect(this.lastSelected);
  880.             }
  881.  
  882.             ListItem var5 = (ListItem)this.items.elementAt(var1);
  883.             var5.bSelected = true;
  884.             var5.bDirty = true;
  885.          }
  886.  
  887.          this.lastSelected = var1;
  888.          this.countSelected = 1;
  889.          this.makeVisible(var1);
  890.       }
  891.  
  892.    }
  893.  
  894.    public synchronized void select(String var1) {
  895.       int var3 = this.items.size();
  896.  
  897.       for(int var4 = 0; var4 < var3; ++var4) {
  898.          ListItem var2 = (ListItem)this.items.elementAt(var4);
  899.          if (var2.sText.equals(var1)) {
  900.             if (var2.bEnabled) {
  901.                this.select(var4);
  902.             }
  903.  
  904.             return;
  905.          }
  906.       }
  907.  
  908.    }
  909.  
  910.    public synchronized void selectMultiple(int var1, boolean var2, boolean var3) {
  911.       if (!this.bMultipleSelections) {
  912.          var2 = false;
  913.          var3 = false;
  914.       }
  915.  
  916.       if (var2) {
  917.          this.shiftSelect(var1, var3);
  918.       } else if (var3) {
  919.          this.ctrlSelect(var1);
  920.       } else {
  921.          this.select(var1);
  922.       }
  923.    }
  924.  
  925.    public synchronized void selectAll() {
  926.       if (this.bMultipleSelections) {
  927.          int var1 = this.items.size();
  928.  
  929.          for(int var3 = 0; var3 < var1; ++var3) {
  930.             ListItem var2 = (ListItem)this.items.elementAt(var3);
  931.             if (var2.bEnabled) {
  932.                var2.bSelected = true;
  933.             }
  934.          }
  935.  
  936.          this.countSelected = var1;
  937.          this.lastSelected = var1 - 1;
  938.          ((Component)this).repaint();
  939.       }
  940.    }
  941.  
  942.    public synchronized void deselect(int var1) {
  943.       if (this.validIndex(var1)) {
  944.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  945.          if (var2.bSelected) {
  946.             if (this.lastSelected == var1) {
  947.                this.lastSelected = -1;
  948.             }
  949.  
  950.             var2.bSelected = false;
  951.             var2.bDirty = true;
  952.             --this.countSelected;
  953.             if (!this.bInternalBlockPaint) {
  954.                ((Component)this).repaint();
  955.             }
  956.          }
  957.       }
  958.  
  959.    }
  960.  
  961.    public synchronized void deselectAll() {
  962.       if (!this.bMultipleSelections) {
  963.          if (this.lastSelected != -1) {
  964.             ListItem var1 = (ListItem)this.items.elementAt(this.lastSelected);
  965.             var1.bSelected = false;
  966.             var1.bDirty = true;
  967.          }
  968.       } else {
  969.          int var2 = this.items.size();
  970.  
  971.          for(int var3 = 0; var3 < var2; ++var3) {
  972.             ListItem var4 = (ListItem)this.items.elementAt(var3);
  973.             if (var4.bSelected) {
  974.                var4.bSelected = false;
  975.                var4.bDirty = true;
  976.             }
  977.          }
  978.       }
  979.  
  980.       this.lastSelected = -1;
  981.       this.countSelected = 0;
  982.       ((Component)this).repaint();
  983.    }
  984.  
  985.    public synchronized boolean isSelected(int var1) {
  986.       if (this.validIndex(var1)) {
  987.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  988.          return var2.bSelected;
  989.       } else {
  990.          return false;
  991.       }
  992.    }
  993.  
  994.    public int getRows() {
  995.       return this.visibleRows;
  996.    }
  997.  
  998.    public boolean allowsMultipleSelections() {
  999.       return this.bMultipleSelections;
  1000.    }
  1001.  
  1002.    public void setMultipleSelections(boolean var1) {
  1003.       if (var1 != this.bMultipleSelections) {
  1004.          if (!var1) {
  1005.             this.deselectAll();
  1006.          }
  1007.  
  1008.          this.bMultipleSelections = var1;
  1009.       }
  1010.  
  1011.    }
  1012.  
  1013.    public int getVisibleIndex() {
  1014.       return this.visibleIndex;
  1015.    }
  1016.  
  1017.    public synchronized void makeVisible(int var1) {
  1018.       this.visibleIndex = var1;
  1019.       if (this.nTopRow > var1) {
  1020.          this.scrollVertical(var1, true);
  1021.       } else {
  1022.          if (var1 >= this.nTopRow + this.visibleRows) {
  1023.             this.scrollVertical(var1 - this.visibleRows + 1, true);
  1024.          }
  1025.  
  1026.       }
  1027.    }
  1028.  
  1029.    public void setTopRow(int var1) {
  1030.       int var2 = this.items.size();
  1031.       if (var2 < this.visibleRows) {
  1032.          var1 = 0;
  1033.       } else if (var1 > var2 - this.visibleRows) {
  1034.          var1 = var2 - this.visibleRows;
  1035.       }
  1036.  
  1037.       if (this.nTopRow != var1) {
  1038.          this.nTopRow = var1;
  1039.          this.bAllDirty = true;
  1040.          ((Component)this).invalidate();
  1041.       }
  1042.  
  1043.    }
  1044.  
  1045.    public Dimension preferredSize(int var1) {
  1046.       Dimension var2 = this.minimumSize(var1);
  1047.       Dimension var3 = ((Component)this).size();
  1048.       return new Dimension(Math.max(var2.width, var3.width), Math.max(var2.height, var3.height));
  1049.    }
  1050.  
  1051.    public Dimension preferredSize() {
  1052.       return this.rowsToShow > 0 ? this.preferredSize(this.rowsToShow) : this.preferredSize(this.items.size());
  1053.    }
  1054.  
  1055.    public Dimension minimumSize(int var1) {
  1056.       this.font = ((Component)this).getFont();
  1057.       if (this.font != null) {
  1058.          this.field_0 = ((Component)this).getFontMetrics(this.font);
  1059.          if (this.field_0 != null) {
  1060.             this.fontHeight = this.field_0.getHeight();
  1061.             if (this.bCellBorders) {
  1062.                this.cellHt = this.fontHeight + 5;
  1063.             } else {
  1064.                this.cellHt = this.fontHeight + 1;
  1065.             }
  1066.  
  1067.             return new Dimension(this.field_0.stringWidth("WN") * this.colsToShow / 2 + 6, var1 * this.cellHt + this.borderWidth + 4);
  1068.          }
  1069.       }
  1070.  
  1071.       return new Dimension(this.borderWidth + 6, this.borderWidth + 4);
  1072.    }
  1073.  
  1074.    public Dimension minimumSize() {
  1075.       return this.rowsToShow > 0 ? this.minimumSize(this.rowsToShow) : this.minimumSize(this.items.size());
  1076.    }
  1077.  
  1078.    public void addNotify() {
  1079.       super.addNotify();
  1080.       this.font = ((Component)this).getFont();
  1081.       this.field_0 = ((Component)this).getFontMetrics(this.font);
  1082.       this.fontHeight = this.field_0.getHeight();
  1083.       this.updateWidths(this.field_0);
  1084.    }
  1085.  
  1086.    public synchronized void setColumns(int var1) {
  1087.       if (this.colsToShow != var1) {
  1088.          this.colsToShow = var1;
  1089.          ((Component)this).invalidate();
  1090.       }
  1091.  
  1092.    }
  1093.  
  1094.    public synchronized void blockPaint(boolean var1) {
  1095.       this.bBlockPaint = var1;
  1096.       if (!this.bBlockPaint) {
  1097.          ((Component)this).repaint();
  1098.       }
  1099.  
  1100.    }
  1101.  
  1102.    public synchronized void setFont(Font var1) {
  1103.       if (var1 != null) {
  1104.          super.setFont(var1);
  1105.          this.field_0 = ((Component)this).getFontMetrics(var1);
  1106.          this.updateWidths(this.field_0);
  1107.          this.xCoord = 0;
  1108.          if (this.bOsFlag) {
  1109.             this.bAllDirty = true;
  1110.             ((Component)this).invalidate();
  1111.          }
  1112.  
  1113.       }
  1114.    }
  1115.  
  1116.    public synchronized void setListBoxFont(Font var1) {
  1117.       this.setFont(var1);
  1118.    }
  1119.  
  1120.    public synchronized Font getListBoxFont() {
  1121.       return super.getFont();
  1122.    }
  1123.  
  1124.    public synchronized void scrollVertical(int var1, boolean var2) {
  1125.       int var3 = this.nTopRow;
  1126.       if (this.visibleRows == 0) {
  1127.          var3 = 0;
  1128.       } else {
  1129.          if (var2) {
  1130.             var3 = var1;
  1131.          } else {
  1132.             switch (var1) {
  1133.                case 601:
  1134.                   --var3;
  1135.                   break;
  1136.                case 602:
  1137.                   ++var3;
  1138.                   break;
  1139.                case 603:
  1140.                   var3 -= this.visibleRows;
  1141.                   break;
  1142.                case 604:
  1143.                   var3 += this.visibleRows;
  1144.             }
  1145.          }
  1146.  
  1147.          if (var3 < 0) {
  1148.             var3 = 0;
  1149.          } else if (var3 > this.items.size() - this.visibleRows) {
  1150.             var3 = this.items.size() - this.visibleRows;
  1151.             if (var3 < 0) {
  1152.                var3 = 0;
  1153.             }
  1154.          }
  1155.       }
  1156.  
  1157.       if (this.nTopRow != var3) {
  1158.          this.nTopRow = var3;
  1159.          this.VBar.setValue(var3);
  1160.          this.bAllDirty = true;
  1161.          if (!this.bInternalBlockPaint) {
  1162.             ((Component)this).repaint();
  1163.          }
  1164.       }
  1165.  
  1166.    }
  1167.  
  1168.    public synchronized void scrollHorizontal(int var1, boolean var2) {
  1169.       int var3 = this.xCoord;
  1170.       if (var2) {
  1171.          var3 = -var1;
  1172.       } else {
  1173.          switch (var1) {
  1174.             case 601:
  1175.                ++var3;
  1176.                break;
  1177.             case 602:
  1178.                --var3;
  1179.                break;
  1180.             case 603:
  1181.                var3 += this.lWidth;
  1182.                break;
  1183.             case 604:
  1184.                var3 -= this.lWidth;
  1185.          }
  1186.       }
  1187.  
  1188.       if (var3 > 0) {
  1189.          var3 = 0;
  1190.       } else if (-var3 > this.HBar.getMaximum()) {
  1191.          var3 = -this.HBar.getMaximum();
  1192.       }
  1193.  
  1194.       if (this.xCoord != var3) {
  1195.          this.xCoord = var3;
  1196.          this.HBar.setValue(-var3);
  1197.          this.bAllDirty = true;
  1198.          if (!this.bInternalBlockPaint) {
  1199.             ((Component)this).repaint();
  1200.          }
  1201.       }
  1202.  
  1203.    }
  1204.  
  1205.    public synchronized void update(Graphics var1) {
  1206.       if (!this.bBlockPaint && !this.bInternalBlockPaint) {
  1207.          this.paint(var1);
  1208.       }
  1209.  
  1210.    }
  1211.  
  1212.    public synchronized void paint(Graphics var1) {
  1213.       Rectangle var2 = var1.getClipRect();
  1214.       if (var2.x != 0 || var2.y != 0) {
  1215.          this.bAllDirty = true;
  1216.          if (this.bClipRectHack) {
  1217.             this.bClipRectHack = false;
  1218.             ((Component)this).repaint();
  1219.             return;
  1220.          }
  1221.       }
  1222.  
  1223.       this.bClipRectHack = false;
  1224.       int var9 = 0;
  1225.       int var10 = 0;
  1226.       byte var11 = 0;
  1227.       int var12 = 0;
  1228.       int var13 = 0;
  1229.       boolean var14 = false;
  1230.       boolean var15 = false;
  1231.       var2 = ((Component)this).bounds();
  1232.       this.font = var1.getFont();
  1233.       this.field_0 = var1.getFontMetrics(this.font);
  1234.       this.fontHeight = this.field_0.getHeight();
  1235.       this.fontDescent = this.field_0.getDescent();
  1236.       int var4 = this.items.size();
  1237.       if (this.bCellBorders) {
  1238.          this.cellHt = this.fontHeight + 5;
  1239.       } else {
  1240.          this.cellHt = this.fontHeight + 1;
  1241.       }
  1242.  
  1243.       if (var4 == 0) {
  1244.          this.nTopRow = 0;
  1245.          this.visibleRows = 0;
  1246.          var15 = false;
  1247.          var14 = false;
  1248.          this.xCoord = 0;
  1249.       } else {
  1250.          if (this.bAllowShowHBar && this.longestLineValue > var2.width - this.borderWidth) {
  1251.             var15 = true;
  1252.             var10 = this.barSize;
  1253.          } else {
  1254.             var15 = false;
  1255.             var10 = 0;
  1256.          }
  1257.  
  1258.          int var8 = (var2.height - var10 - this.borderWidth - 4) / this.cellHt;
  1259.          if (this.bAllowShowVBar && var4 > var8) {
  1260.             var14 = true;
  1261.             var9 = this.barSize;
  1262.             if (!var15 && this.bAllowShowHBar && this.longestLineValue > var2.width - this.borderWidth - var9) {
  1263.                var15 = true;
  1264.                var10 = this.barSize;
  1265.                var8 = (var2.height - var10 - this.borderWidth - 4) / this.cellHt;
  1266.             }
  1267.          } else {
  1268.             var14 = false;
  1269.             var9 = 0;
  1270.          }
  1271.  
  1272.          if (this.visibleRows != var8) {
  1273.             this.visibleRows = var8;
  1274.             this.bAllDirty = true;
  1275.          }
  1276.  
  1277.          if (var14) {
  1278.             this.VBar.reshape(var2.width - this.barSize - this.halfBorderWidth, this.halfBorderWidth, this.barSize, var2.height - this.borderWidth - var10);
  1279.             this.VBar.setValues(this.nTopRow, this.visibleRows, 0, var4 - this.visibleRows);
  1280.             this.VBar.setPageIncrement(this.visibleRows);
  1281.             this.lWidth = var2.width - var9 - this.borderWidth;
  1282.             if (!this.bVBarVisible) {
  1283.                this.bVBarVisible = true;
  1284.                this.VBar.show();
  1285.             }
  1286.          } else {
  1287.             this.lWidth = var2.width - this.borderWidth;
  1288.             if (this.bVBarVisible) {
  1289.                this.bVBarVisible = false;
  1290.                this.VBar.hide();
  1291.             }
  1292.          }
  1293.  
  1294.          if (var15) {
  1295.             this.HBar.reshape(this.halfBorderWidth, var2.height - this.barSize - this.halfBorderWidth, var2.width - this.borderWidth - var9, this.barSize);
  1296.             this.HBar.setValues(-this.xCoord, this.lWidth, 0, this.longestLineValue - this.lWidth);
  1297.             this.HBar.setPageIncrement(this.lWidth);
  1298.             if (!this.bHBarVisible) {
  1299.                this.bHBarVisible = true;
  1300.                this.HBar.show();
  1301.             }
  1302.          } else if (this.bHBarVisible) {
  1303.             this.bHBarVisible = false;
  1304.             this.HBar.hide();
  1305.          }
  1306.       }
  1307.  
  1308.       if (var4 == 0 || this.bAllDirty) {
  1309.          var1.clearRect(this.halfBorderWidth, this.halfBorderWidth, var2.width - this.borderWidth, var2.height - this.borderWidth);
  1310.       }
  1311.  
  1312.       if (this.borderType == 0) {
  1313.          var1.setColor(Color.black);
  1314.          var1.drawLine(0, 0, var2.width - 2, 0);
  1315.          var1.drawLine(0, 0, 0, var2.height - 2);
  1316.          var1.setColor(Color.gray);
  1317.          var1.drawLine(1, 1, var2.width - 3, 1);
  1318.          var1.drawLine(1, 1, 1, var2.height - 3);
  1319.          var1.setColor(Color.lightGray);
  1320.          var1.drawLine(1, var2.height - 2, var2.width - 2, var2.height - 2);
  1321.          var1.drawLine(var2.width - 2, 1, var2.width - 2, var2.height - 3);
  1322.          var1.setColor(Color.white);
  1323.          var1.drawLine(0, var2.height - 1, var2.width - 1, var2.height - 1);
  1324.          var1.drawLine(var2.width - 1, 0, var2.width - 1, var2.height - 1);
  1325.       }
  1326.  
  1327.       var1.clipRect(this.halfBorderWidth, this.halfBorderWidth, this.lWidth, var2.height - this.halfBorderWidth);
  1328.       if (this.nTopRow >= var4) {
  1329.          this.nTopRow -= this.visibleRows + 1;
  1330.       }
  1331.  
  1332.       int var6 = this.nTopRow;
  1333.       int var7 = Math.min(this.nTopRow + this.visibleRows, var4);
  1334.  
  1335.       for(int var16 = 0; var6 < var7; ++var16) {
  1336.          var12 = var16 * this.cellHt + this.yAdj;
  1337.          var13 = (var16 + 1) * this.cellHt + this.yAdj;
  1338.          ListItem var3 = (ListItem)this.items.elementAt(var6);
  1339.          if (var3.bDirty || this.bAllDirty) {
  1340.             var3.bDirty = false;
  1341.             var1.clearRect(this.halfBorderWidth, var12, this.lWidth, this.cellHt);
  1342.          }
  1343.  
  1344.          int var5;
  1345.          if (var3.image != null) {
  1346.             var5 = this.halfBorderWidth + 19 + 2;
  1347.          } else {
  1348.             var5 = this.halfBorderWidth;
  1349.          }
  1350.  
  1351.          if (var3.bCellBorder) {
  1352.             var11 = 2;
  1353.          } else {
  1354.             var11 = 0;
  1355.          }
  1356.  
  1357.          if (var3.bSelected) {
  1358.             var1.drawImage(this.SelectImage, this.xCoord + var5 + var11, var12, this.lWidth - this.xCoord, this.cellHt, this);
  1359.             var1.setColor(Color.white);
  1360.          } else if (var3.bEnabled) {
  1361.             if (var3.color == null) {
  1362.                var1.setColor(this.enabledColor);
  1363.             } else {
  1364.                var1.setColor(var3.color);
  1365.             }
  1366.          } else {
  1367.             var1.setColor(this.disabledColor);
  1368.          }
  1369.  
  1370.          var1.drawString(var3.sText, this.xCoord + var5 + var11, var13 - this.fontDescent);
  1371.          if (var3.image != null) {
  1372.             var1.drawImage(var3.image, this.xCoord + this.halfBorderWidth + var11 + 2, var12 + 2, 19, this.cellHt - 3, this);
  1373.          }
  1374.  
  1375.          if (var3.bCellBorder) {
  1376.             var1.setColor(var3.cellBorderColor);
  1377.             var1.drawRect(this.halfBorderWidth, var12, this.lWidth, this.cellHt);
  1378.          }
  1379.  
  1380.          ++var6;
  1381.       }
  1382.  
  1383.       this.extraPaint(var1, var2);
  1384.       this.bAllDirty = false;
  1385.    }
  1386.  
  1387.    public void extraPaint(Graphics var1, Rectangle var2) {
  1388.    }
  1389.  
  1390.    public synchronized void show() {
  1391.       this.bAllDirty = true;
  1392.       super.show();
  1393.    }
  1394.  
  1395.    public synchronized void reshape(int var1, int var2, int var3, int var4) {
  1396.       this.bAllDirty = true;
  1397.       this.bClipRectHack = true;
  1398.       super.reshape(var1, var2, var3, var4);
  1399.    }
  1400.  
  1401.    public synchronized void setDirty() {
  1402.       this.bAllDirty = true;
  1403.    }
  1404.  
  1405.    public boolean allSelected() {
  1406.       return this.countSelected == this.items.size();
  1407.    }
  1408.  
  1409.    public void setDirectNotify(boolean var1) {
  1410.       this.bDirectNotify = var1;
  1411.    }
  1412.  
  1413.    protected boolean validIndex(int var1) {
  1414.       return var1 >= 0 && var1 < this.items.size();
  1415.    }
  1416.  
  1417.    protected boolean isVisibleIndex(int var1) {
  1418.       return var1 >= this.nTopRow && var1 < this.nTopRow + this.visibleRows;
  1419.    }
  1420.  
  1421.    protected String paramString() {
  1422.       return super.paramString() + ", selected=" + this.getSelectedItem();
  1423.    }
  1424.  
  1425.    protected void shiftSelect(int var1, boolean var2) {
  1426.       int var3 = 0;
  1427.       int var4 = 0;
  1428.       if (this.lastSelected == -1) {
  1429.          this.select(var1);
  1430.       } else if (this.lastSelected == var1) {
  1431.          if (!var2) {
  1432.             this.bInternalBlockPaint = true;
  1433.             this.select(var1);
  1434.             this.bInternalBlockPaint = false;
  1435.          }
  1436.       } else if (this.lastSelected < var1) {
  1437.          if (!this.isEnabled(var1)) {
  1438.             return;
  1439.          }
  1440.  
  1441.          if (var2) {
  1442.             var3 = this.lastSelected + 1;
  1443.             var4 = Math.min(this.items.size(), var1 + 1);
  1444.          } else {
  1445.             var3 = 0;
  1446.             var4 = this.items.size();
  1447.          }
  1448.  
  1449.          for(; var3 < var4; ++var3) {
  1450.             ListItem var5 = (ListItem)this.items.elementAt(var3);
  1451.             if (var3 >= this.lastSelected && var3 <= var1) {
  1452.                if (!var5.bSelected) {
  1453.                   var5.bDirty = true;
  1454.                   var5.bSelected = true;
  1455.                   ++this.countSelected;
  1456.                }
  1457.             } else if (var5.bSelected) {
  1458.                var5.bDirty = true;
  1459.                var5.bSelected = false;
  1460.                --this.countSelected;
  1461.             }
  1462.          }
  1463.       } else if (this.lastSelected > var1) {
  1464.          if (!this.isEnabled(var1)) {
  1465.             return;
  1466.          }
  1467.  
  1468.          if (var2) {
  1469.             var4 = Math.min(this.items.size(), this.lastSelected);
  1470.          } else {
  1471.             var3 = 0;
  1472.             var4 = this.items.size();
  1473.          }
  1474.  
  1475.          for(int var8 = 0; var8 < var4; ++var8) {
  1476.             ListItem var11 = (ListItem)this.items.elementAt(var8);
  1477.             if (var8 >= var1 && var8 <= this.lastSelected) {
  1478.                if (!var11.bSelected) {
  1479.                   var11.bDirty = true;
  1480.                   var11.bSelected = true;
  1481.                   ++this.countSelected;
  1482.                }
  1483.             } else if (var11.bSelected) {
  1484.                var11.bDirty = true;
  1485.                var11.bSelected = false;
  1486.                --this.countSelected;
  1487.             }
  1488.          }
  1489.       }
  1490.  
  1491.       if (!this.bInternalBlockPaint) {
  1492.          ((Component)this).repaint();
  1493.       }
  1494.  
  1495.    }
  1496.  
  1497.    protected void ctrlSelect(int var1) {
  1498.       ListItem var2 = (ListItem)this.items.elementAt(var1);
  1499.       if (var2.bEnabled) {
  1500.          if (var2.bSelected) {
  1501.             var2.bSelected = false;
  1502.             --this.countSelected;
  1503.             this.lastSelected = -1;
  1504.          } else {
  1505.             var2.bSelected = true;
  1506.             ++this.countSelected;
  1507.             this.lastSelected = var1;
  1508.          }
  1509.  
  1510.          var2.bDirty = true;
  1511.          if (!this.bInternalBlockPaint) {
  1512.             ((Component)this).repaint();
  1513.          }
  1514.  
  1515.       }
  1516.    }
  1517.  
  1518.    protected int mouseCalcIndex(int var1) {
  1519.       int var2;
  1520.       if (var1 < this.yAdj) {
  1521.          var2 = this.nTopRow - 1;
  1522.       } else {
  1523.          var2 = (var1 - this.yAdj) / this.cellHt + this.nTopRow;
  1524.       }
  1525.  
  1526.       if (var2 >= this.items.size()) {
  1527.          var2 = -1;
  1528.       } else if (var2 < 0) {
  1529.          var2 = 0;
  1530.       }
  1531.  
  1532.       return var2;
  1533.    }
  1534.  
  1535.    private void updateWidth(ListItem var1) {
  1536.       int var2 = var1.lineWidth + 6;
  1537.       if (var1.image != null) {
  1538.          var2 += 19;
  1539.       }
  1540.  
  1541.       if (var2 > this.longestLineValue) {
  1542.          this.longestLineValue = var2;
  1543.       }
  1544.  
  1545.    }
  1546.  
  1547.    private void updateWidths(FontMetrics var1) {
  1548.       this.longestLineValue = 0;
  1549.       int var2 = this.items.size();
  1550.       int var3 = 0;
  1551.  
  1552.       for(int var5 = 0; var5 < var2; ++var5) {
  1553.          ListItem var4 = (ListItem)this.items.elementAt(var5);
  1554.          var4.updateWidth(var1);
  1555.          var3 = var4.lineWidth + 6;
  1556.          if (var4.image != null) {
  1557.             var3 += 19;
  1558.          }
  1559.  
  1560.          if (var3 > this.longestLineValue) {
  1561.             this.longestLineValue = var3;
  1562.          }
  1563.       }
  1564.  
  1565.    }
  1566.  
  1567.    private void notifyParent(Event var1, int var2, boolean var3) {
  1568.       Object var4 = null;
  1569.       if (this.ilbParent != null) {
  1570.          var4 = this.ilbParent;
  1571.       } else if (this.bDirectNotify) {
  1572.          var4 = ((Component)this).getParent();
  1573.       }
  1574.  
  1575.       if (var4 == null) {
  1576.          var4 = this;
  1577.       }
  1578.  
  1579.       if (var3) {
  1580.          ((Component)var4).postEvent(new Event(this, var1.when, 1001, var1.x, var1.y, var1.key, this.lastDownModifiers, this.getSelectedItem()));
  1581.       } else {
  1582.          if (var1.x >= 0 && var1.x - this.xCoord < 19) {
  1583.             ListItem var5 = (ListItem)this.items.elementAt(var2);
  1584.             if (var5.image != null) {
  1585.                ((Component)var4).postEvent(new Event(this, var1.when, 16388, var1.x, var1.y, var1.key, this.lastDownModifiers, new Integer(var2)));
  1586.             }
  1587.          }
  1588.  
  1589.          ((Component)var4).postEvent(new Event(this, var1.when, 701, var1.x, var1.y, var1.key, this.lastDownModifiers, new Integer(var2)));
  1590.       }
  1591.    }
  1592.  
  1593.    private int keyCalcIndex(int var1, boolean var2) {
  1594.       if (var2) {
  1595.          this.lastIndex = var1;
  1596.       } else {
  1597.          this.lastIndex += var1;
  1598.       }
  1599.  
  1600.       if (this.lastIndex >= this.items.size()) {
  1601.          this.lastIndex = this.items.size() - 1;
  1602.       } else if (this.lastIndex < 0) {
  1603.          this.lastIndex = 0;
  1604.       }
  1605.  
  1606.       return this.lastIndex;
  1607.    }
  1608. }
  1609.